Home /

Developer Resource Kit 5 Article

Image Sprayer

Image Sprayer is a Macromedia Flash tool that allows you to "spray" shapes onto the screen. By adjusting the settings that control each shape's hue, saturation, lightness, scale, and rotation, and by spraying with different motions, you can create a surprising variety of graphics.

Figure 1. Examples of the Image Sprayer tool


Installing Image Sprayer

To install Image Sprayer, double-click Sprayer.mxp. This installs the tool using the Macromedia Extension Manager, which you can also use to uninstall it.

Using Image Sprayer

The default location of Image Sprayer is under the Brush tool in the Tools panel. You can bring Image Sprayer to the top by clicking the triangle in the bottom corner of the Brush icon. Once you select it, draw by holding down the mouse button and dragging across the Stage.

To modify the default settings, press the Spacebar to bring up the Configuration dialog box. This dialog box has three panels: Color, Transform, and Shape.

The Color panel allows you to pick ranges between which Image Sprayer modulates the hue, saturation, and lightness of the sprayed shapes. You can also determine how quickly Image Sprayer moves between those ranges. Below the Color section is the Tails section. Tails appear at the beginning and end of a sprayed line; they grow into the default size and then shrink when the stroke is finished. This gives the spray tapered ends. The circles represent the number of shapes used to taper the beginning and end of all sprayed lines. These tapers occur after you release the mouse button so be sure to keep control of the mouse for an extra second or two.

Color panel

Figure 2. The Color panel

The Transform panel allows you to modify the range of the scale and rotation, as well as control how quickly the shapes move between each end of a given range. If you do not wish to have your shapes rotate or scale while you spray, you can simply disable the feature by unchecking Tween Scale or Tween Rotation. The red part of the rotation group's background bar represents counterclockwise rotation, while the green area represents clockwise rotation. It is possible to set one slider in each area to make your shape rotate one way for a while and then slow down and reverse the direction of its spinning.

Transform panel

Figure 3. The Transform panel

The Shape panel allows you to choose the shape of the sprayer. There are over 20 from which to choose. The default shapes are stored with the tool, and the custom shapes are stored per document. Preview the shape by clicking its name. This brings up the shape's outline in the preview box and selects the shape for use. When you exit the Configuration dialog box, Image Sprayer is loaded with your selected shape and settings, and is ready to use.

Shape panel

Figure 4. The Shape panel

The Shape panel allows you to create your own shapes with which to spray:

  1. Create a shape. It must be a single closed shape.
  2. Because the center point is based on the top-left corner of the Stage (the 0,0 point), manually adjust your shape until it is in the desired location. The shape will automatically be scaled; you do not need to adjust the size.
  3. Once the shape is where you want it to be, select the Sprayer tool and press the Spacebar to bring up the Image Sprayer Settings dialog box.
  4. Select the Shape tab if it is not already selected.
  5. If you wish, give your new shape a name by typing it in the Name text box.
  6. Click the Create from Selection button to create the shape, add it to the list of default shapes, and select it automatically.

To use it, simply exit the Sprayer Settings dialog box and begin spraying.

Because these shapes are stored both in the tool and in the document, you can switch documents and continue using your new shape, as well as retain your created shapes when you save a document. You can continue using the same tool setup even after closing and reopening Flash. If no documents are saved, however, the tool alone will not remember custom shapes between Flash sessions.

Manually Controlling Image Sprayer

Aside from the automatic tween settings, you can also control the different parameters manually. To do this you press the number keys on the main part of the keyboard (not the keypad).

The available transformations map as follows:

  • 1-2 Scale (decrease and increase)
  • 3-4 Rotation (decrease and increase)
  • 5-6 Hue (decrease and increase)
  • 7-8 Saturation (decrease and increase)
  • 9-0 Lightness (decrease and increase)

Figure 5. Example of manually controlling the parameters.

There are two ways to use these keys:

Tween options

Figure 6. Tween options

The first way is fully manually. You can set this mode by turning off the automatic tweening for the Scale, Color, or Rotation options. You do this by unchecking the Tween option in the desired section. When this happens, the default scale/rotation/hue/etc. value is set to the left (minimum value) slider. The speed of change is set according to the Speed of Change slider. So even though these options are disabled, they still determine the starting values. When you go back to the Image Sprayer, you can adjust the values by pressing the appropriate numeric keys while moving the mouse. Using Scale as an example, pressing 1 shrinks the spray target, while pressing 2 enlarges it. You do not have to disable all options, of course. For example, you could tween the color automatically, while adjusting the rotation manually.


The second way to control the sprayer manually with the numeric keys is by not disabling the tools. In this mode, the keys still increment and decrement the sizes; however, they are still subject to the minimum and maximum values specified in their respective panels. When you press the keys, automatic tweening is still in effect. Using Scale as an example again, pressing 1 shrinks the spray target until it reaches the minimum value set in the Scale section of the Transform panel, where it will stay. Releasing the 1 key resumes automatic tweening.

Happy spraying!